Merge and export columns

Hello Together,

We require data to be exported from Doors to excel with some merging functionalities.

Iterating each column, I have to identify columns with same name and merge them as a single column. Also the values in the columns need to be concatenated and exported to excel.

For ex. Column names be Constant 1 ,Constant 2 & constant3; Values be 23, 45 , 87 respectively.

In the exported sheet, i need data in single column "Constants" with value : Constant1 = 23 , Constant 2 = 45, Constant3 = 87.

Please provide us some support on this issue.

Thanks !!


Adminani - Thu Jul 02 07:06:09 EDT 2015

Re: Merge and export columns
woodpryan - Thu Jul 02 12:26:13 EDT 2015

This is not a DXL support group, actually. It's not like we get paid to do other people's jobs for them. Have you written any code? Have you made any effort on this task on your own?

Re: Merge and export columns
Adminani - Thu Jul 02 23:29:21 EDT 2015

woodpryan - Thu Jul 02 12:26:13 EDT 2015

This is not a DXL support group, actually. It's not like we get paid to do other people's jobs for them. Have you written any code? Have you made any effort on this task on your own?

I completely agree with your point. I believe this forum is to provide information for users who are get struck with using dxl.

I am not a professional dxl developer and that's where we are in need of seeking your help!!

Also, its not like we raise a question in forum as soon as we get the requirement. Everyone will do spend some effort on their own. Upon facing some failures we come here..!

 

I tried this option and i couldn't find any way to read every columns in both horizontal & vertical manner at same time. I have searched the dxl reference booklet.

"Object next(sibling(Object o))" -> is always returning null!! and couldn't find any option to read the adjacent cell value from current cell. That's what made me to post a question here.!

 

 

 

Re: Merge and export columns
pommCannelle - Fri Jul 03 09:39:47 EDT 2015

Adminani - Thu Jul 02 23:29:21 EDT 2015

I completely agree with your point. I believe this forum is to provide information for users who are get struck with using dxl.

I am not a professional dxl developer and that's where we are in need of seeking your help!!

Also, its not like we raise a question in forum as soon as we get the requirement. Everyone will do spend some effort on their own. Upon facing some failures we come here..!

 

I tried this option and i couldn't find any way to read every columns in both horizontal & vertical manner at same time. I have searched the dxl reference booklet.

"Object next(sibling(Object o))" -> is always returning null!! and couldn't find any option to read the adjacent cell value from current cell. That's what made me to post a question here.!

 

 

 

Hi !!

 

You have to analyse the titles to find the ones to build and merge ... then you can build your new columns and build the display ... 
Easy to say ... I've built a quick start to demonstrate how to do it ;)

I let you to build the columns and to loop through the objects to build what to display in your column ... 

/////////////////////////////
// TOOLS 
/////////////////////////////
Skip split ( string s, char c ) {
    Skip split_string = create()
    int deb = 0; int i; int index = 0
    for ( i=0; i<length(s)-1; i++ ) {
      if ( s[i] != c ) continue;
      put( split_string, index, s[deb:i-1] )
      deb = i+1; index += 1
    }
    if ( s[i] == c ) i--
    put( split_string, index, s[deb:i] )
    return(split_string)
}
////
string trim(string s){
    if (null s) return s
    int i,j,k // init dans les boucles for
    for (i=0;i<length(s);i++) { if (s[i] != ' ' && s[i] != '\t' && s[i] != ';' ) break }
    for (j=length(s)-1;j>=0;j--) { if (s[j] != ' ' && s[j] != '\t' && s[i] != ';' ) break }
    if (j < i) return ""
    return s[i:j]
}
//// 

/////////////////////////////
// GLOBALS 
/////////////////////////////

Column c_ref, c

Skip skp_to_merge = null
Skip skp_used = null
Skip skp_tmp = null

/////////////////////////////
// analyse the columns ... 
/////////////////////////////
for c_ref in current Module do {
    if ( ! null skp_used ) {
        if ( find ( skp_used, title c_ref"" ) ) continue
    }

    Skip skp = split( trim title c_ref, ' ' )
    string ref = ""
    for ref in skp do break
    delete skp
    
    skp_tmp = null
    string title_start = ""

    for c in current Module do {
        if ( c == c_ref ) continue
        if ( ! null skp_used ) 
            if ( find ( skp_used, title c ) ) continue
         
        skp = split( trim title c, ' ')
        for title_start in skp do break
        delete skp

        if (title_start != ref) continue
        if (null skp_tmp) skp_tmp = createString()
        put(skp_tmp, title c_ref, c_ref)
        put(skp_tmp, title c, c)
        if (null skp_used) skp_used = createString()
        put(skp_used, title c, c)
    }
    
    if ( ! null skp_tmp ) {
        if (null skp_to_merge) skp_to_merge = createString()
        put(skp_to_merge, ref, skp_tmp) 
        // in the skip skp_to_merge you have the titles of the columns to build
        // as key and the columns to merge as data ... 
        put(skp_used, title c_ref"", c_ref)
    } else {
        // do nothing
    }

    skp_tmp = null
}

/////////////////////////////
// build the new columns
/////////////////////////////
if ( ! null skp_to_merge ) {
    int n_col = -1
    for c in current Module do n_col++
    // use this n_col value as index to create new columns ... 
    string col_title
    for skp_tmp in skp_to_merge do {
        // here you have the title of the column to build
        col_title = ( string key skp_to_merge )
        print col_title "\n"
        // here you have all the columns to merge ...
        for c in skp_tmp do print "    " title c "\n"
        // you have to add a loop through the objects of the module 
        // to build your display ... no big deal ;)
        // use the function text(c, obj) to get the text of the concerned columns
    }
}

// delete the initials columns ?
// for c in skp_used do delete c

/////////////////////////////
// clean memory
/////////////////////////////
if ( ! null skp_to_merge ) {
    for skp_tmp in skp_to_merge do delete skp_tmp
    delete skp_to_merge
}
if ( ! null skp_to_keep ) delete skp_to_keep
if ( ! null skp_used ) delete skp_used